# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

source "$(dirname ${BASH_SOURCE[0]})"/../mingw-w64-PKGBUILD-common/kde-frameworks
_realname=breeze
pkgbase="mingw-w64-${_realname}"
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=6.3.5
pkgrel=1
pkgdesc="Artwork, styles and assets for the Breeze visual style for the Plasma Desktop (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: breeze'
)
msys2_repository_url='https://invent.kde.org/plasma/breeze/'
url='https://kde.org/plasma-desktop/'
license=('spdx:LGPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme"
         "${MINGW_PACKAGE_PREFIX}-breeze-icons"
         "${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-kcolorscheme"
         "${MINGW_PACKAGE_PREFIX}-kconfig"
         "${MINGW_PACKAGE_PREFIX}-kcoreaddons"
         "${MINGW_PACKAGE_PREFIX}-kguiaddons"
         "${MINGW_PACKAGE_PREFIX}-ki18n"
         "${MINGW_PACKAGE_PREFIX}-kiconthemes"
         "${MINGW_PACKAGE_PREFIX}-kirigami"
         "${MINGW_PACKAGE_PREFIX}-kwindowsystem"
         "${MINGW_PACKAGE_PREFIX}-qt6-base"
         "${MINGW_PACKAGE_PREFIX}-qt6-declarative")
makedepends=("${MINGW_PACKAGE_PREFIX}-7zip"
             "${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-extra-cmake-modules"
             "${MINGW_PACKAGE_PREFIX}-gettext-tools"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-qt6-tools")
groups=("${MINGW_PACKAGE_PREFIX}-plasma")
source=("https://download.kde.org/stable/plasma/${pkgver}/${_realname}-${pkgver}.tar.xz"{,.sig})
noextract=("${_realname}-${pkgver}.tar.xz")
sha256sums=('5803d8e3d4edf7de26e2df21ec28662b611a0bca505c39b991c7763dba6026ab'
            'SKIP')
validpgpkeys=('E0A3EB202F8E57528E13E72FD7574483BB57B18D') # Jonathan Esk-Riddell <jr@jriddell.org>

prepare() {
  7z x -bso0 -bsp0 "${_realname}-${pkgver}.tar.xz"
  7z x -bso0 -bsp0 -ttar "${_realname}-${pkgver}.tar"
  python "$(dirname ${BASH_SOURCE[0]})"/../mingw-w64-PKGBUILD-common/replace-symlinks.py "${_realname}-${pkgver}"
}

build() {
  declare -a _extra_config
  if check_option "debug" "n"; then
    _extra_config+=("-DCMAKE_BUILD_TYPE=Release")
  else
    _extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
  fi

  _kde_build_env
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    "${MINGW_PREFIX}"/bin/cmake.exe \
      -GNinja \
      -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
      "${_KDE_INSTALL_DIRS[@]}" \
      -DBUILD_TESTING=OFF \
      -DBUILD_QT5=OFF \
      "${_extra_config[@]}" \
      -S "${_realname}-${pkgver}" \
      -B "build-${MSYSTEM}"

  "${MINGW_PREFIX}"/bin/cmake.exe --build "build-${MSYSTEM}"
}

package() {
  DESTDIR="${pkgdir}" "${MINGW_PREFIX}"/bin/cmake.exe --install "build-${MSYSTEM}"
}
